Skip to content

Conversation

@Viicos
Copy link
Member

@Viicos Viicos commented Mar 18, 2025

Change Summary

Part of pydantic/pydantic#9400.

This is only implemented for model fields but this could be done for dataclass/typed dict as well. I only went with models for now as it is the only data type where extra validation can be customized through __pydantic_extra__.

This also only implements validation support. Extra values can have serialization customized but I don't think we should also allow serialization customization for extra keys as we don't have such a concept for "normal" field names.

Related issue number

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@Viicos Viicos requested a review from davidhewitt March 18, 2025 11:51
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Performance Report

Merging #1671 will not alter performance

Comparing extra-keys-validation (651657c) with main (ac17f0c)

Summary

✅ 157 untouched benchmarks

@Viicos Viicos merged commit f256531 into main Mar 20, 2025
29 checks passed
@Viicos Viicos deleted the extra-keys-validation branch March 20, 2025 13:35
davidhewitt pushed a commit to pydantic/pydantic that referenced this pull request Oct 20, 2025
…ntic-core#1671)

This is only implemented for model fields but this could be done for dataclass/typed dict as well. I only went with models for now as it is the only data type where extra validation can be customized through `__pydantic_extra__`.

This also only implements validation support. Extra values can have serialization customized but I don't think we should also allow serialization customization for extra keys as we don't have such a concept for "normal" field names.

Original-commit-hash: f256531
davidhewitt pushed a commit to pydantic/pydantic that referenced this pull request Oct 22, 2025
…ntic-core#1671)

This is only implemented for model fields but this could be done for dataclass/typed dict as well. I only went with models for now as it is the only data type where extra validation can be customized through `__pydantic_extra__`.

This also only implements validation support. Extra values can have serialization customized but I don't think we should also allow serialization customization for extra keys as we don't have such a concept for "normal" field names.

Original-commit-link: pydantic/pydantic-core@f256531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants